package com.shenmazong.user.controller;

import com.shenmazong.user.pojo.TbSysUser;
import com.shenmazong.user.service.TbSysUserService;
import com.shenmazong.utils.ResultResponse;
import com.shenmazong.vo.IdVo;
import com.shenmazong.vo.LoginUserInfoVo;
import com.shenmazong.vo.PageInfoVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 军哥
 * @version 1.0
 * @description: 系统用户接口
 * @date 2022/4/3 9:39
 */

@RestController
@Slf4j
@RequestMapping(value = "/sysUser")
public class SysUserController {

    @Autowired
    TbSysUserService tbSysUserService;

    @PostMapping(value = "/add")
    public ResultResponse add(@RequestBody TbSysUser user) {
        return tbSysUserService.add(user);
    }

    @PostMapping(value = "/del")
    public ResultResponse del(@RequestBody IdVo idVo) {
        return tbSysUserService.del(idVo);
    }

    @PostMapping(value = "/set")
    public ResultResponse set(@RequestBody TbSysUser user) {
        return tbSysUserService.set(user);
    }

    @PostMapping(value = "/getSysUserById")
    public ResultResponse getSysUserById(@RequestBody IdVo idVo) {
        return tbSysUserService.getSysUserById(idVo);
    }

    @PostMapping(value = "/getSysUserByPage")
    public ResultResponse getSysUserByPage(@RequestBody PageInfoVo pageInfoVo) {
        return tbSysUserService.getSysUserByPage(pageInfoVo);
    }

    @PostMapping(value = "/loginByUserName")
    public ResultResponse loginByUserName(@RequestBody LoginUserInfoVo loginUserInfoVo) {
        return tbSysUserService.loginByUserName(loginUserInfoVo);
    }
}
